<%--
  Created by IntelliJ IDEA.
  User: lichengming
  Date: 2017/8/17
  Time: 下午3:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/resources.jsp" %>

<html>
<head>
    <title>Title</title>
    <style type="text/css">
        .base_info {
            display: flex;
            justify-content: space-around;
        }
        .base_info_item {
            width: 50%;
        }
        .distribution_ratio {
            width: 80px;
            height: 80px;
            border-radius: 40px;
            border: 10px solid orange;
            text-align: center;
            line-height: 60px;
            margin: 0 auto;
            background-color: #716235;
            color: white;
        }
        .ratio_wrap {
            padding: 10px;
            margin-right: 10px;
            cursor: pointer;
        }
        .ratio_wrap_active {
            background-color: #739494;
        }

        .well label {
            font-weight: bold;
        }

        .search_area_agent {
            margin-top: 10px;
            width: 150px;
        }
        .search_result {
            margin-top: 10px;
            display: none;
        }

        .search_result img {
            height: 72px;
            width: 72px;
            border-radius: 72px;
        }
        .search_user_info {
            text-align: center;
            float: left;
            padding: 10px;
            cursor: pointer;
        }
        .search_user_info_select {
            background-color: rgba(244, 239, 138, 0.4);
        }
        .search_user_info p{
            margin-top: 5px;
            margin-bottom: 0;
        }
    </style>
</head>
<body>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">厂家直销活动商品申请审核</h3>
        </div>

        <div class="panel-body">
            <div class="base_info well" style="width: 100%">
                <div class="panel-body base_info_item">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <h4>商铺基本信息</h4>
                            <div>

                                <p><label>店铺名称：</label>${record.shop.store_name_}</p>

                                <p><label>店铺logo：</label></p>
                                <p>
                                    <img src="${record.shop.logo_}" style="width: 50%;height: 50%">
                                </p>

                                <p><label>店铺类型：</label>${record.shop.business_type_}</p>

                                <p><label>店铺地址：</label>${record.shop.addr_}</p>

                                <p><label>创建时间：</label>${record.shop.create_time_}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="panel-body">
            <div class="panel panel-default">
                <div class="panel-body">
                    <h4>申请资料</h4>
                    <div class="well" style="width: 100%">

                        <p><label>主标题：</label>${record.name_}</p>

                        <p><label>副标题：</label>${record.sub_name_}</p>

                        <p><label>产品主图：</label></p>
                        <p>
                            <img src="${record.mainImage}" style="width: 50%;height: 50%" />
                        </p>

                        <c:if test="${not empty record.subImageList}">
                            <p><label>产品副图：</label></p>
                            <c:forEach items="${record.subImageList}" var="subImage">
                                <p>
                                    <img src="${subImage.cloud_path_}" style="width: 50%;height: 50%" />
                                </p>
                            </c:forEach>
                        </c:if>

                        <p><label>简介：</label>${record.summary_}</p>

                    </div>

                    <div class="well">
                        <button type="button" id="audit_succeed" class="btn btn-success">审核通过</button>
                        <button type="button" id="audit_fail" class="btn btn-danger">审核不通过</button>
                    </div>
                </div>
            </div>
        </div>
</div>

<script>

    $(".ratio_wrap").on("click",function () {
        $(this).siblings().removeClass("ratio_wrap_active");
        $(this).toggleClass("ratio_wrap_active");
    })


    $("#audit_succeed").on("click",function () {

        var data = {};
        data["id"] = '${record.id}';
        data["status"] = 1;

        $.emsAjax({
            url:"/ems/selldirect/auditUpdate",
            data:data,
            type:"POST",
            success:function (resp) {
                if (resp.status == "000") {
                    $.toast(resp.message,function () {
                        window.location.href = "/ems/culture/index"
                    });
                }else {
                    $.toast(resp.message,"text");
                }
            }
        })
    });

    $("#audit_fail").on("click",function () {
        $.emsAjax({
            url:"/ems/selldirect/auditUpdate",
            data:{status:-1,id:'${record.id}'},
            type:"POST",
            success:function (resp) {
                if (resp.status == "000") {
                    $.toast(resp.message,function () {
                        window.location.href = "/ems/culture/index"
                    });
                }else {
                    $.toast(resp.message,"cancel");
                }
            }
        })
    });


</script>
</body>
</html>
